
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <link href="/static/devtools30/layui/css/layui.css" rel="stylesheet" />
    <link href="/static/devtools30/css/devindexbase.css" rel="stylesheet" />
    <script src="/static/devtools30/js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="/static/devtools30/layui/layui.all.js" type="text/javascript"></script>
    <script src="/static/devtools30/js/devtoolCommon.js" type="text/javascript"></script>
    <title>新增功能</title>
    <style>
        /*页面内边距*/
        .addwrap {
            padding: 30px;
        }
        /*按钮组边框*/
        .layui-btn-primary {
            border: 1px solid #C9C9C9!important;
        }
        /*输入框高度*/
        .addwrap .layui-input,
        .layui-select {
            height: 25px;
        }

        .addwrap .layui-input-block {
            min-height: 26px;
            margin-left: 30px;
        }

        .addwrap .layui-form-label {
            padding: 0;
            text-align: right;
            height: 26px;
            line-height: 26px;
            width: 80px;
        }
        .layui-form-radio>i {
            font-size: 17px !important;
        }
        .layui-form-radio {
            line-height: 12px !important;
        }
        .layui-form-radio * {
            font-size: 12px;
        }
        .layui-form-item .layui-form-checkbox[lay-skin=primary] {
            margin-top: 3px !important;
        }
        .layui-form-checkbox span {

            font-size: 12px !important;
        }
        .width120{
            width: 120px;
        }
        .layui-textarea {
            min-height: auto !important;
        }
    </style>
</head>
<body>
<div class="addwrap">
    <di class="layui-form" lay-filter="form" >

        <input type="hidden" name="id" id="id" class="layui-input" th:value="${data.id}">
        <input type="hidden" name="templeid" id="templeid" class="layui-input" th:value="${data.templeid}">
        <div class="layui-form-item flex height26">
            <label class="layui-form-label">序号</label>
            <div class="layui-input-block width120">
                <input  id="xh" name="xh" th:value="${data.xh}" type="number" onkeydown="DigitInput(this)"   required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">显示名称</label>
            <div class="layui-input-block width120">
                <input  id="btnlabel" name="btnlabel" th:value="${data.btnlabel}" type="text"   required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-block marginleft10" >
                <input id="useflag" type="checkbox" name="useflag" value="1" th:checked="${data.useflag eq 1} ? 'checked' :'false'" title="启用" lay-skin="primary"  />
            </div>
        </div>
        <div class="layui-form-item flex height26">

            <label class="layui-form-label">动作类型</label>
            <div class="layui-input-block width120">
                <select name="action" id="action" lay-verify="required">
                    <option value="newwin">弹窗</option>
                    <option value="nowin">不弹窗</option>
                    <option value="newpage">新页面</option>

                </select>
            </div>
            <label class="layui-form-label">显示位置</label>
            <div class="layui-input-block width120">
                <select name="position" id="position" lay-verify="required">
                    <option value="add">添加栏</option>
                    <option value="edit">编辑栏</option>

                </select>
            </div>

        </div>
        <div class="flex height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">弹窗宽度</label>
                <div class="layui-input-block width120">
                    <input  id="width" name="width" th:value="${data.width}" type="text"  autocomplete="off" class="layui-input">
                </div>
                <label class="layui-form-label">弹窗高度</label>
                <div class="layui-input-block width120">
                    <input  id="height" name="height" th:value="${data.height}" type="text"   autocomplete="off" class="layui-input">
                </div>

            </div>

        </div>

        <div class="layui-form-item layui-form-text flex">
            <label class="layui-form-label">链接地址</label>
            <div class="layui-input-block" style="width: 580px!important;">
                <textarea name="btnurl" id="btnurl"  class="layui-textarea">[(${data.btnurl})]</textarea>
                <div>url参数替换使用#字段名称#,可以为表格的列字段名称或搜索框的控件名称</div>
            </div>

        </div>
        <div class="layui-form-item layui-form-text flex">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block" style="width: 580px!important;">
                <textarea name="bz" id="bz"  class="layui-textarea">[(${data.bz})]</textarea>
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block flex flex-jusity-around tjbtn">
                <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary qx" onclick="closeWin()">取消</button>
                <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit lay-filter="save">保存</button>
            </div>
        </div>
    </di>
</div>
</body>
<script>
    $(function(){
        initEvent();

    });
    function closeWin(){
        dlCommon.closeParentLayer();
    }

    function initEvent(){
        layui.form.on('submit(save)', function(data){
            saveData();
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        $("#position option[value='[(${data.position})]']").attr("selected", "selected");
        $("#action option[value='[(${data.action})]']").attr("selected", "selected");

        layui.form.render();
    }
    function saveData(){
        var data = layui.form.val('form');
        if(data.useflag==undefined){
            data.useflag=0;
        }

        dlCommon.post("/DevtFormListTemplOtherBtnController/save",data,function(res){
            if(!res.success){
                dlCommon.layerError(res.msg);
                return;
            }
            dlCommon.layerSuccess("保存成功",function(){
                parent.getOtherBtnList();
                closeWin();
            })
        },true)
    }





</script>

</html>